Do you have a bunch of scanned charts of your area, in graphical format (jpg, tiff, etc.) and OpenCPN won't read them?
Here's how you can – with a bit of work, sure, but worth the effort – convert them into usable electronic charts.
ImageMagick:
http://www.imagemagick.org/ (Binary releases are available for a few distributions, for Ubuntu just get it with the package manager, it's in the repositories.)
Libbsb:
http://libbsb.sourceforge.net (You will need some version of libtiff-dev and libpng-dev installed to build it. A .deb package that worked fine for me can be found at
libBSB.
mc2bsbh: you can get it
here.
Get the c++ source file, and from its directory, type:
g++ -Wall -s -O2 mc2bsbh.cpp -o mc2bsbh
It compiled without any problem on my (very standard) Karmic. I personally put it in /usr/local/bin, which I own as user, so it's in the PATH and can be called from anywhere, if you leave it in the working directory, use ./mc2bsbh
MapCal: part of the free navigation package SeaClear .
Note: I had some problems running it with Wine (saving the calibration) but I can't reproduce the error and now it works fine. One suggestion is, make the directory you're going to write the calibration in world-writable before running MapCal.
The pcx2tif script (optional) , found
pcx2tif.zip here. This is a great little shell script by “taifun” used to convert old Maptech-style formats of tiled charts. If you find your chart is made of little bits instead of a whole file, this will stitch them all together in TIFF format.
Instructions for use are in the tarball.
Once we have the tools all set up, we can get to work. The process in in five steps:
Convert a chart image to tiff with imagemagick.
Convert it again to png with the same (you'll need both files).
Load the png version of the chart in Mapcal and calibrate it.
Generate the chart header with mc2bsbh, and make the .kap version of the chart, with libbsb.
Copy the resulting .kap into opencpn's chart dir, and reload the chart database.
Let's see them in detail:
Steps 1 and 2:
Say you have a chart in jpeg format called chart.jpg.
From the command line, use:
convert chart.jpg -colors 127 chart.gif
and then again,
convert chart.gif -colors 127 chart.tif
and then again,
convert chart.jpg -colors 127 chart.png
(there is a script that does this for multiple files, get it here , just remove the .doc extension, this is the example)
Throw away the .gif file. Don't ask me why you need to generate it in the first place, but apparently you do, it's an imagemagick thing. Keep the .tif and the .png ones a while longer, though. You'll be even happier to get rid of them when you've finished.
Step 3:
Open MapCal.
File, Open Image. Open the .png version of your chart. Ignore the data window for the moment, you'll do that later, click OK. You should see your chart.
To calibrate it, choose a point near a corner for which it is easy to know lat/lon. Right-click on it, and choose Add New Cal. Point. To zoom in and out use the little + and – buttons at the bottom.
Ignore the fact that Latitude has three integer figures, we're still talking about the Earth. Enter the coordinates and proceed for at least three more points, near the corners.
Click Activate Changes. Check that the grid makes sense. Click Border, draw a border around the chart (that part is easy).
Be sure to have the calibration or borders done properly, so you have no problems after choosing Set border to Image in MapCal. Also, find the tiny + and - zoom buttons which are very helpful…
You should also enter some data for the chart: Edit, Chart Information.
The Chart Name will show up in OpenCPN to remind you of all your hard work, choose it well.
For this example we'll just use “chart”.
You should also enter at least Scale (found on the chart) Depth Units, Projection (Mercator most likely) and Datum (WGS84 most likely, but be careful with older charts). All of this information should be found on the chart itself.
For more details, you have the SeaClear Manual.
File, Save Calibration. Repeat ad-lib for any other charts and exit. If everything went well, you'll find a file called CHARTCAL.DIR in the same directory as you loaded your png chart from. This is used to (finally) make your calibrated chart that OpenCPN will use, as detailed in
Step 4:
Note 1: you can also make the .hdr file “manually”, using a template and entering the calibration data with a text editor, but I won't go into that for the moment.
Note 2 (about the commands, so if there's any problem you know what to look for) :
convert is a command from imagemagick.
tif2bsb is a command from libbsb.
mc2bsbh is a standalone thing.
Note 3: (by Jonasberg, on the colors in the conversions) :
The “127” is the number of individual colors used. Sometimes it pays of to reduce this number to get a smaller file size, say, if you start with a bitmapped format like png that contains fewer colors.
Note 4: On the joinpcx script:
If you use it “standalone” and not as part of the “charts” script, change the lines,
convert new1.gif - colors 127 $1.tif
(and .png) to
convert new1.gif -colors 127 `basename $PWD`.tif
(and .png)
because the “$1” will not create files with [directory_name].tif and .png, it won't create any files at all.
Using `basename $PWD`will make files called [current directory name].tif (and .png).
So just edit the script to whatever suits you best.